package com.xin.data.simbapesa.fragment;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewbinding.ViewBinding;

import com.google.gson.JsonObject;
import com.xin.data.simbapesa.PathMaping;
import com.xin.data.simbapesa.R;
import com.xin.data.simbapesa.SimbaApp;
import com.xin.data.simbapesa.activity.SimbaAccountActivity;
import com.xin.data.simbapesa.activity.SimbaCustomerServiceActivity;
import com.xin.data.simbapesa.activity.SimbaLoginActivity;
import com.xin.data.simbapesa.adapter.CardAdapter;
import com.xin.data.simbapesa.api.PU;
import com.xin.data.simbapesa.api.RxHttp;
import com.xin.data.simbapesa.api.U;
import com.xin.data.simbapesa.base.BaseActivity;
import com.xin.data.simbapesa.base.BaseBindingAdapter1;
import com.xin.data.simbapesa.base.BaseDialog;
import com.xin.data.simbapesa.base.BaseFragment;
import com.xin.data.simbapesa.base.BaseParams;
import com.xin.data.simbapesa.databinding.SimbaState2FragmentBinding;
import com.xin.data.simbapesa.dialog.BindCardDialog;
import com.xin.data.simbapesa.obj.SimbaAccountItem;
import com.xin.data.simbapesa.obj.SimbaDetailInfo;
import com.xin.data.simbapesa.obj.SimbaPlatformNotice;
import com.xin.data.simbapesa.obj.SimbaUserProcess;
import com.xin.data.simbapesa.utils.AESCryptUtilJar;
import com.xin.data.simbapesa.utils.DateUtils;
import com.xin.data.simbapesa.utils.JsonParse;
import com.xin.data.simbapesa.utils.LogUtil;
import com.xin.data.simbapesa.utils.NumUtils;
import com.xin.data.simbapesa.utils.OrderUtils;
import com.xin.data.simbapesa.utils.PhoneUtils;
import com.xin.data.simbapesa.utils.PopUtils;
import com.xin.data.simbapesa.utils.ResUtils;
import com.xin.data.simbapesa.utils.SpUtils;
import com.xin.data.simbapesa.utils.ViewUtils;
import com.xin.data.simbapesa.view.SimbaSpaceItemDecoration;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class StateFragment2 extends BaseFragment<SimbaState2FragmentBinding> {


    int time;

    private final int TIME_WHAT = 1;

    String applyDate;

    CardAdapter adater;
    List<SimbaAccountItem> dataList;


    SimbaDetailInfo detailInfo;

    String orderId;


    BaseActivity<ViewBinding> mActivity;

    int state;

    OnRefreshState2Listener onRefreshStateListener;

    TextView tvOk;

    BindCardDialog bindCardDialog;

    @Override
    public void onAttach(@androidx.annotation.NonNull Context context) {
        super.onAttach(context);
        try {
            onRefreshStateListener = (OnRefreshState2Listener) context;
        } catch (ClassCastException ignored) {
        }
    }


    @Override
    protected SimbaState2FragmentBinding initViewBinding(LayoutInflater inflater, ViewGroup container) {
        return SimbaState2FragmentBinding.inflate(inflater);
    }

    @Override
    protected void initView() {


        mActivity = (BaseActivity<ViewBinding>) getActivity();

        binding.getRoot().setPadding(0, 0, 0, 0);

        mActivity.setStatusBarHeight(binding.refresh);


        orderId = getActivity().getIntent().getStringExtra("orderId");

        if (orderId == null) {
            orderId = "";
        }

        LogUtil.e("me", "orderId->" + orderId);

        state = OrderUtils.getOrderStatus();

        applyDate = getActivity().getIntent().getStringExtra("applyDate");


        if (TextUtils.isEmpty(applyDate)) {
            applyDate = DateUtils.getDate4();
        }

        binding.tvCs.setOnClickListener(v -> {
            ViewUtils.viewScale(v);
            if (state == 2) {
                PU.userBuriedPoint(PU.P45, "");
            } else if (state == 3) {
                PU.userBuriedPoint(PU.P44, "");
            } else {
                PU.userBuriedPoint(PU.P43, "");
            }
            startActivity(new Intent(getActivity(), SimbaCustomerServiceActivity.class));
        });

        binding.refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                if (state == 2) {
                    PU.userBuriedPoint(PU.P51, "");
                } else if (state == 3) {
                    PU.userBuriedPoint(PU.P50, "");
                } else {
                    PU.userBuriedPoint(PU.P49, "");
                }
                loadData();
                if (onRefreshStateListener != null) {
                    onRefreshStateListener.onLoadState();
                }
            }
        });
        binding.tvBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewUtils.viewScale(v);
                if (state == 2) {
//                    PU.userBuriedPoint(PU.P51, "");
                    PU.userBuriedPoint(PU.P54, "");
                    if (onRefreshStateListener != null) {
                        onRefreshStateListener.onSwitchFragment(1);
                    }
                    return;
                } else if (state == 3) {
                    PU.userBuriedPoint(PU.P50, "");
                } else {
                    PU.userBuriedPoint(PU.P49, "");
                }
                loadData();
                if (onRefreshStateListener != null) {
                    onRefreshStateListener.onLoadState();
                }
            }
        });
        binding.tvBtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewUtils.viewScale(v);
                if (onRefreshStateListener != null) {
                    onRefreshStateListener.onSwitchFragment(1);
                }
            }
        });
        binding.tvBtn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewUtils.viewScale(v);
                startActivity(new Intent(getActivity(), SimbaAccountActivity.class));
            }
        });
        binding.tvDelete.setOnClickListener(v -> {
            ViewUtils.viewScale(v);
            PU.userBuriedPoint(PU.P51, "");
            time = 10;
            showDeleteUser();
            mHandler.sendEmptyMessageDelayed(TIME_WHAT, 1000);
        });
        dataList = new ArrayList<>();
        adater = new CardAdapter(dataList);
        adater.setOnBtnItemClickListener(new BaseBindingAdapter1.BtnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                startActivity(new Intent(getActivity(), SimbaAccountActivity.class));
            }
        });
        LinearLayoutManager manager = new LinearLayoutManager(getActivity());
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        binding.recyclerView.setLayoutManager(manager);
        int d = ResUtils.d(R.dimen.dp_4);
        binding.recyclerView.addItemDecoration(new SimbaSpaceItemDecoration(0, d, getActivity()));
        binding.recyclerView.setAdapter(adater);


    }

    @Override
    protected void initData() {
        loadData();
    }

    @SuppressLint("HandlerLeak")
    final
    Handler mHandler = new Handler(Looper.getMainLooper()) {
        @Override
        public void handleMessage(@androidx.annotation.NonNull Message msg) {
            super.handleMessage(msg);
            if (msg.what == TIME_WHAT) {
                mHandler.removeMessages(TIME_WHAT);
                time = time - 1;
                if (time > 0) {
                    showDeleteUser();
                    mHandler.sendEmptyMessageDelayed(TIME_WHAT, 1000);
                } else {
                    showDeleteUser();
                }
            }
        }
    };

    void showDeleteUser() {

        String okStr;
        if (time > 0) {
            okStr = ResUtils.s(R.string.delete_btn) + "(" + time + ")";
        } else {
            okStr = ResUtils.s(R.string.delete_btn);
        }
        if (tvOk == null) {
            tvOk = PopUtils.showDeleteUserPop(getActivity(), binding.recyclerView, (title, value, position, index) -> {
                if (title.equals("0")) {
                    tvOk.setText(ResUtils.s(R.string.delete_btn));
                    tvOk.setSelected(false);
                } else {
                    dropUserData("DROP");
                }
                mHandler.removeMessages(TIME_WHAT);
                tvOk = null;
            });
        }
        tvOk.setText(okStr);
        tvOk.setSelected(time <= 0);


    }

    void dropUserData(String type) {

        String token = SpUtils.get_string(getContext(), SpUtils.KEY_TOKEN, "");
        JsonObject json = BaseParams.getJsonObject(getActivity(), PathMaping.PathList[89], U.URL_MAIN_PRODUCT, token);
        json.addProperty("type", type);
        HashMap<String, String> heads = new HashMap<>();
        heads.put("product", U.URL_MAIN_PRODUCT);
        if (!TextUtils.isEmpty(U.URL_COUNTRY)) {
            heads.put("country", U.URL_COUNTRY);
        }
        if (type.equals("DROP")) {
            mActivity.showLoading("");
        }
        RxHttp.post(U.commonUrl, AESCryptUtilJar.encryptDefault(json.toString()), heads)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<>() {
                    @Override
                    public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {

                    }

                    @Override
                    public void onNext(@io.reactivex.rxjava3.annotations.NonNull String s) {
                        if (binding != null) {
                            mActivity.hideLoading();
                            if (!TextUtils.isEmpty(s)) {
                                String json1 = AESCryptUtilJar.decryptDefault(s);
                                LogUtil.e("me", type + "<-dropUserData json->" + json1+",state->"+state);
                                if (type.equalsIgnoreCase("GET")) {
                                    String showDropButton = JsonParse.dropUserDataJson2Obj(json1);
                                    if (!TextUtils.isEmpty(showDropButton)) {
                                        if (state == 2) {
                                            if (showDropButton.equals("YES")) {
                                                binding.tvDelete.setVisibility(View.VISIBLE);
                                            } else {
                                                binding.tvDelete.setVisibility(View.GONE);
                                            }
                                        }
                                    }
                                } else {
                                    if (JsonParse.getCode(json1)) {
                                        exit();
                                    } else {
                                        if (mActivity != null) {
                                            mActivity.showToastDialog(R.mipmap.hit_icon, JsonParse.getMsg(getActivity(), json1));
                                        }
                                    }
                                }
                            }
                        }
                    }

                    @Override
                    public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {

                        LogUtil.e("me", type + "<-dropUserData e->" + e);

                        if (mActivity != null) {
                            mActivity.hideLoading();
                            if (!type.equalsIgnoreCase("GET")) {
                                mActivity.showToastDialog(R.mipmap.hit_icon, getResources().getString(R.string.start_net_failed));
                            }
                        }
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }

    void exit() {
        if (getActivity() != null) {
            SpUtils.save_string(getActivity(), SpUtils.KEY_PHONE, "");
            SpUtils.save_string(getActivity(), SpUtils.KEY_USERID, "");
            SpUtils.save_string(getActivity(), SpUtils.KEY_TOKEN, "");
            SpUtils.save_int(getActivity(), SpUtils.KEY_SCORE_NUM, 0);
            Intent intent = new Intent(getActivity(), SimbaLoginActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            SimbaApp.getInstance().clearActivity();
            getActivity().finish();
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mHandler.removeMessages(TIME_WHAT);
        if (bindCardDialog != null) {
            bindCardDialog.dismiss();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (state == 2) {
            PU.userBuriedPoint(PU.P41, "");
        } else if (state == 3) {
            PU.userBuriedPoint(PU.P39, "");
        } else {
            PU.userBuriedPoint(PU.P37, "");
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if (state == 2) {
            PU.userBuriedPoint(PU.P42, "");
        } else if (state == 3) {
            PU.userBuriedPoint(PU.P40, "");
        } else {
            PU.userBuriedPoint(PU.P38, "");
        }
    }


    void loadData() {
        getApplyDetail();


        dropUserData("GET");

        mActivity.userProcess(null, false);

    }

    @SuppressLint("SetTextI18n")
    void setData() {


        if (binding != null) {


            if (getActivity() != null) {

                String currency = "";
                if (detailInfo != null) {
                    currency = detailInfo.getCurrency();
                }
                if (TextUtils.isEmpty(currency)) {
                    currency = SpUtils.get_string(getContext(), SpUtils.KEY_CURRENCY, "");
                }

                state = OrderUtils.getOrderStatus();


                binding.tvHit1.setVisibility(View.GONE);
                binding.tvBtn2.setVisibility(View.GONE);

                if (state == 2) {

                    binding.tvIcon.setImageResource(R.mipmap.state2_icon2);
                    binding.tvStatus.setText(ResUtils.s(R.string.state2_status2));
                    binding.tvStatus.setTextColor(Color.parseColor("#FF4D14"));


                    String date;
                    if (SimbaApp.getInstance().getAppInfo() != null && !TextUtils.isEmpty(SimbaApp.getInstance().getAppInfo().getRejectAfterDays())) {
                        date = SimbaApp.getInstance().getAppInfo().getRejectAfterDays();
                        int day = NumUtils.str2Int(date);
                        if (day > 0) {
                            date = DateUtils.getNowDateForDays(day);
                        }
                    } else {
                        date = DateUtils.getNowDateForDays(30);
                    }


                    binding.tvTips.setText(Html.fromHtml(ResUtils.s(R.string.state2_hit2, date)));

                    binding.tvTipsLayout.setVisibility(View.VISIBLE);
                    binding.tvBtn1.setVisibility(View.VISIBLE);
//                    binding.tvDelete.setVisibility(View.VISIBLE);
                    binding.tvTitle.setVisibility(View.GONE);
                    binding.recyclerView.setVisibility(View.GONE);
                    binding.tvHit.setVisibility(View.GONE);
                    binding.tvBtn.setVisibility(View.GONE);

                    if (mActivity != null) {
                        mActivity.hideTipsDialog();
                    }


                } else if (state == 3) {

                    binding.tvIcon.setImageResource(R.mipmap.state2_icon3);
                    binding.tvStatus.setText(ResUtils.s(R.string.state2_status3));
                    binding.tvStatus.setTextColor(Color.parseColor("#FF8717"));

                    binding.tvHit.setVisibility(View.GONE);
                    binding.tvBtn.setVisibility(View.VISIBLE);
                    binding.tvTitle.setVisibility(View.VISIBLE);
                    binding.recyclerView.setVisibility(View.VISIBLE);

                    binding.tvTipsLayout.setVisibility(View.GONE);
                    binding.tvBtn1.setVisibility(View.GONE);
                    binding.tvDelete.setVisibility(View.GONE);

                    if (U.isCameroon) {
                        binding.tvHit1.setVisibility(View.VISIBLE);
                        binding.tvBtn2.setVisibility(View.VISIBLE);
                        binding.tvTitle.setText(ResUtils.s(R.string.state2_title5));
                    } else {
                        binding.tvTitle.setText(ResUtils.s(R.string.state2_title4));
                        binding.tvBtn2.setVisibility(View.GONE);
                    }


                    showNotice();


                } else {

                    binding.tvIcon.setImageResource(R.mipmap.state2_icon1);
                    binding.tvStatus.setText(ResUtils.s(R.string.state2_status1));
                    binding.tvStatus.setTextColor(Color.parseColor("#703CE3"));

                    binding.tvHit.setVisibility(View.VISIBLE);
                    binding.tvBtn.setVisibility(View.VISIBLE);
                    binding.tvTitle.setVisibility(View.VISIBLE);
                    binding.recyclerView.setVisibility(View.VISIBLE);


                    binding.tvTipsLayout.setVisibility(View.GONE);
                    binding.tvBtn1.setVisibility(View.GONE);
                    binding.tvDelete.setVisibility(View.GONE);

                    if (U.isCameroon) {
                        binding.tvBtn2.setVisibility(View.VISIBLE);
                        binding.tvTitle.setText(ResUtils.s(R.string.state2_title5));
                    } else {
                        binding.tvTitle.setText(ResUtils.s(R.string.state2_title4));
                        binding.tvBtn2.setVisibility(View.GONE);
                    }

                    showNotice();

                }


                if (detailInfo != null) {

                    String amount = detailInfo.getAmount();

                    if (!detailInfo.getAmount().contains(currency.toUpperCase())) {
                        amount = detailInfo.getAmount() + currency.toUpperCase();
                    }

                    binding.tvAmount.setText(amount);
                    binding.tvTerm.setText(ResUtils.s(R.string.state2_day, detailInfo.getDays()));

                }

            }
        }

    }

    void getApplyDetail() {

        if (binding != null && mActivity != null) {
            JsonObject json = BaseParams.getJsonObject(getActivity(), PathMaping.PathList[12]);
            HashMap<String, String> heads = new HashMap<>();
            heads.put("product", U.URL_PRODUCT);
            if (!TextUtils.isEmpty(U.URL_COUNTRY)) {
                heads.put("country", U.URL_COUNTRY);
            }
            mActivity.showLoading("");
            RxHttp.post(U.commonUrl, AESCryptUtilJar.encryptDefault(json.toString()), heads)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(new Observer<>() {
                        @Override
                        public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {

                        }

                        @Override
                        public void onNext(@io.reactivex.rxjava3.annotations.NonNull String s) {
                            if (binding != null) {
                                binding.refresh.setRefreshing(false);
                                if (!TextUtils.isEmpty(s)) {
                                    String json1 = AESCryptUtilJar.decryptDefault(s);
                                    LogUtil.e("me", "getApplyDetail json->" + json1);
                                    if (JsonParse.getCode(json1)) {
                                        detailInfo = JsonParse.getApplyDetailJson2Obj(json1);
                                        setData();
                                        getBindCardList();
                                    } else {
                                        mActivity.showFailedDialog(new BaseDialog.BtnClickListener() {
                                            @Override
                                            public void btnOnClickOk() {
                                                loadData();
                                            }

                                            @Override
                                            public void btnOnClickCancel() {

                                            }

                                            @Override
                                            public void btnOnClickColse() {

                                            }
                                        });
                                    }
                                }
                                if (mActivity != null) {
                                    mActivity.hideLoading();
                                }
                            }
                        }

                        @Override
                        public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {


                            LogUtil.e("me", "getApplyDetail e->" + e);


                            if (binding != null) {
                                binding.refresh.setRefreshing(false);
                                if (mActivity != null && !mActivity.isFinishing() && binding != null) {
                                    mActivity.hideLoading();
                                    mActivity.showFailedDialog(new BaseDialog.BtnClickListener() {
                                        @Override
                                        public void btnOnClickOk() {
                                            loadData();
                                        }

                                        @Override
                                        public void btnOnClickCancel() {

                                        }

                                        @Override
                                        public void btnOnClickColse() {

                                        }
                                    });
                                }
                            }

                        }

                        @Override
                        public void onComplete() {

                        }
                    });
        }

    }

    void getBindCardList() {
        if (binding != null && mActivity != null) {
            JsonObject json = BaseParams.getJsonObject(getActivity(), PathMaping.PathList[67]);
            HashMap<String, String> heads = new HashMap<>();
            heads.put("product", U.URL_PRODUCT);
            if (!TextUtils.isEmpty(U.URL_COUNTRY)) {
                heads.put("country", U.URL_COUNTRY);
            }
            mActivity.showLoading("");
            RxHttp.post(U.commonUrl, AESCryptUtilJar.encryptDefault(json.toString()), heads)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(new Observer<String>() {
                        @Override
                        public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {

                        }

                        @Override
                        public void onNext(@io.reactivex.rxjava3.annotations.NonNull String s) {

                            if (binding != null && mActivity != null) {
                                mActivity.hideLoading();
                                binding.refresh.setRefreshing(false);
                                if (!TextUtils.isEmpty(s)) {
                                    String json1 = AESCryptUtilJar.decryptDefault(s);
                                    LogUtil.e("me", "getBindCardList json->" + json1);
                                    if (JsonParse.getCode(json1)) {
                                        List<SimbaAccountItem> cardInfos = JsonParse.getBindCardListJson2Obj(json1);
                                        if (cardInfos != null && !cardInfos.isEmpty()) {
                                            for (SimbaAccountItem item : cardInfos) {
                                                if (U.isCameroon) {
                                                    if (item.getWalletDesc().equals("MTN")) {
                                                        item.setWalletLogo("https://divoire.s3.af-south-1.amazonaws.com/pic/33149e4bbeb2466dac7665034f9e84e6.jpg");
                                                    }
                                                    if (item.getWalletDesc().equals("Orange Money")||item.getWalletDesc().equals("ORANGE")) {
                                                        item.setWalletLogo("https://divoire.s3.af-south-1.amazonaws.com/app/Orangemoneylogo.png");
                                                    }
                                                } else {
                                                    item.setWalletDesc(ResUtils.s(R.string.cardName));
                                                    item.setWalletLogo("https://data-ghana.s3.af-south-1.amazonaws.com/pic/278c615a7279424e9cbe48208bae614e.jpg");
                                                }
                                            }
                                            dataList.clear();
                                            dataList.addAll(cardInfos);
                                            adater.updateAllData();
                                            LogUtil.e("me", "dataList->" + dataList.size());


                                            if (dataList.size() < 2 && OrderUtils.getOrderStatus() == 1 && PhoneUtils.isFayu(getActivity())) {
                                                showBindCardTipsDialog();
                                            }
                                        }
                                    }
                                }
                            }

                        }

                        @Override
                        public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {

                            LogUtil.e("me", "getBindCardList e->" + e);


                            if (binding != null && mActivity != null) {
                                mActivity.hideLoading();
                                binding.refresh.setRefreshing(false);
                                if (mActivity != null) {
                                    mActivity.showFailedDialog(new BaseDialog.BtnClickListener() {
                                        @Override
                                        public void btnOnClickOk() {
                                            loadData();
                                        }

                                        @Override
                                        public void btnOnClickCancel() {

                                        }

                                        @Override
                                        public void btnOnClickColse() {

                                        }
                                    });
                                }

                            }
                        }

                        @Override
                        public void onComplete() {

                        }
                    });
        }
    }

    void showBindCardTipsDialog() {
        if (getActivity() != null) {
            bindCardDialog = new BindCardDialog(getActivity());
            bindCardDialog.setOnBtnClickListener(new BaseDialog.BtnClickListener() {
                @Override
                public void btnOnClickOk() {
                    startActivity(new Intent(getActivity(), SimbaAccountActivity.class));
                }

                @Override
                public void btnOnClickCancel() {

                }

                @Override
                public void btnOnClickColse() {

                }
            });
            bindCardDialog.show();
        }
    }


    void showNotice() {
        if (mActivity != null && !isHidden() && binding != null) {
            SimbaUserProcess process = SimbaApp.getInstance().getProcess();
            if (process != null) {
                if ((!TextUtils.isEmpty(process.getWhatsappFlag()) && !process.getWhatsappFlag().equals("YES")) && (!TextUtils.isEmpty(process.getSmsFlag()) && !process.getSmsFlag().equals("YES")) && (!TextUtils.isEmpty(process.getTelegramFlag()) && !process.getTelegramFlag().equals("YES"))) {
                    if (SimbaApp.getInstance().getAppInfo() != null) {
                        SimbaPlatformNotice platformNotice = SimbaApp.getInstance().getAppInfo().getPlatformNotice();
                        if (platformNotice != null && platformNotice.getShowNotice().equals("YES")) {
                            mActivity.showTipsDialog(ResUtils.s(R.string.noticeTitle), "", ResUtils.s(R.string.birth_btn), platformNotice.getNoticeInfo(), true, new BaseDialog.BtnClickListener() {
                                @Override
                                public void btnOnClickOk() {

                                }

                                @Override
                                public void btnOnClickCancel() {

                                }

                                @Override
                                public void btnOnClickColse() {

                                }
                            });
                        }
                    }
                }
            }
        }
    }


    public interface OnRefreshState2Listener {
        void onLoadState();

        void onSwitchFragment(int position);
    }


}
